import time
import secrets
import base62
import hashlib
class ULIDGenerator:
    @staticmethod
    def generate() -> str:
        timestamp = int(time.time() * 1e9).to_bytes(16, 'big')
        rand_data = secrets.token_bytes(48)
        hash_digest = hashlib.sha3_512(timestamp + rand_data).digest()[:32]
        full_data = timestamp + rand_data + hash_digest
        return base62.encodebytes(full_data).ljust(128, '0')[:128]